<template>
	<view>
		<video id="myVideo" :src="url" @click="playvideo" @fullscreenchange="fullscreenchange" enable-danmu danmu-btn controls >
		 </video>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url:'',
			}
		},
		onLoad(option) {
			this.url = option.url
		},
		onReady() {
			this.playvideo()
		},
		methods: {
			playvideo (e){
				// console.log(e)
				this.videoContext = uni.createVideoContext('myVideo', this);
				this.videoContext.requestFullScreen({direction: 0});
				this.videoContext.play()
			},
			fullscreenchange (e){
			    if(!e.detail.fullScreen){  
			       uni.navigateBack({
			       	delta:1
			       })
			    }
			},
		}
	}
</script>

<style>
	page{
		display: flex;
		justify-content: center;
		align-items: center;
		background-color: #000;
		height: 100%;
	}
	video {
		max-width: 100%;
		max-height: 100%;
	}
</style>
